import { MenuItem } from './type'

function createMenuItems(
  num: number,
  startValue: number = 0,
  labelPrefix: string = 'item'
) {
  const result: MenuItem[] = []
  for (let i = 0; i < num; i++) {
    result.push({
      value: startValue + i,
      label: labelPrefix + (i === 0 ? '' : i)
    })
  }
  return result
}

/**
 * 获取菜单栏数据
 */
export function getMenuData() {
  const menus = createMenuItems(3)
  menus[0].children = createMenuItems(20, 100, 'subItem')
  return menus
}
